﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;

namespace Three_Red_Dragon_Mvc.Controllers
{
    public class UsersController : Controller
    {
        private readonly IpAddressesConfig _ipAddressesConfig;

        public UsersController(IOptions<IpAddressesConfig> ipAddressesConfig)
        {
            _ipAddressesConfig = ipAddressesConfig.Value;
        }
        public IActionResult Index()
        {
            return View();
        }
        public IActionResult User()
        {
            ViewBag.RBACWrite = _ipAddressesConfig.RBACWrite;
            ViewBag.RedDragonWrite = _ipAddressesConfig.RedDragonWrite;
            return View();
        }
        public IActionResult AddUser()
        {
            ViewBag.RBACWrite = _ipAddressesConfig.RBACWrite;
            ViewBag.RedDragonWrite = _ipAddressesConfig.RedDragonWrite;
            return View();
        }
        /// <summary>
        /// 用户显示列表视图
        /// </summary>
        /// <returns>返回视图</returns>
        public IActionResult GetRoles()
        {
            ViewBag.RBACWrite = _ipAddressesConfig.RBACWrite;
            ViewBag.RedDragonWrite = _ipAddressesConfig.RedDragonWrite;
            return View();
        }
        /// <summary>
        /// 角色添加视图
        /// </summary>
        /// <returns>返回视图</returns>
        public IActionResult GetAddRoles()
        {
            ViewBag.RBACWrite = _ipAddressesConfig.RBACWrite;
            ViewBag.RedDragonWrite = _ipAddressesConfig.RedDragonWrite;
            return View();
        }
    }
}
